/* style.css – CrafterTools modern, responsive, dark-mode aware */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #8b5cf6;
  --secondary-hover: #7c3aed;
  --outline: #e2e8f0;
  --error: #ef4444;
  --success: #10b981;
  --radius-card: 24px;
  --radius-btn: 14px;
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.04);
  --shadow-md: 0 12px 32px rgba(0,0,0,0.08);
  --transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary: #8b5cf6;
    --secondary-hover: #a78bfa;
    --outline: #334155;
    --error: #f87171;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-md: 0 12px 32px rgba(0,0,0,0.5);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.main-nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
}

.main-nav a.active,
.main-nav a:hover {
  color: var(--primary);
}

/* Tool Card */
.tool-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin: 2rem 0;
  transition: var(--transition);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.privacy-notice {
  background: rgba(59, 130, 246, 0.08);
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--outline);
  border-radius: 20px;
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  position: relative;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.04);
  outline: none;
}

.drop-zone i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: block;
}

.browse-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

/* File Info */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-radius: 16px;
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--outline);
  animation: fadeIn 0.3s ease;
}

.file-details {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow: hidden;
}

.file-details i {
  font-size: 1.4rem;
  color: var(--primary);
}

.file-details span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

#fileMeta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* Password Section */
.password-section {
  margin-bottom: 1.5rem;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  width: 100%;
  padding: 0.85rem 1rem;
  padding-right: 2.8rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-btn);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

.password-wrapper input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem;
}

/* Strength meter */
.strength-meter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.strength-bar {
  flex: 1;
  height: 6px;
  background: var(--outline);
  border-radius: 4px;
  overflow: hidden;
}

#strengthFill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: var(--error);
  transition: width 0.3s, background 0.3s;
}

#strengthText {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 70px;
  color: var(--text-secondary);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(59,130,246,0.25);
}

.btn.secondary {
  background: var(--secondary);
  color: #fff;
}

.btn.secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(139,92,246,0.25);
}

.btn.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--outline);
}

.btn.outline:hover:not(:disabled) {
  background: var(--outline);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Progress */
.progress-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 16px;
  margin-bottom: 1.5rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--outline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result-container {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

#resultMessage {
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.75rem;
}

.download-btn {
  display: inline-flex;
}

/* Error */
.error-message {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--error);
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s;
}

.hidden {
  display: none !important;
}

/* SEO Sections */
.seo-section {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.seo-section h2 {
  font-size: 1.4rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.seo-section h2:first-of-type {
  margin-top: 0;
}

.seo-section p, .seo-section li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.seo-section ul, .seo-section ol {
  padding-left: 1.5rem;
}

.faq details {
  background: var(--bg);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--outline);
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.faq summary:focus-visible {
  outline: 2px solid var(--primary);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 640px) {
  .tool-card {
    padding: 1.5rem;
    border-radius: 20px;
  }
  .action-buttons {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
  .file-details span {
    max-width: 150px;
  }
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 0;
  }
  .main-nav a {
    margin-left: 1rem;
    font-size: 0.9rem;
  }
}